<?php
defined('IN_ADMIN') or exit('No permission resources.');
$show_validator = $show_scroll = $show_dialog = 1;
include $this->admin_tpl('header', 'admin');
?>
<script type="text/javascript">
function ages()   
{		
	  var str = $("input[name='talent[birthday]']").val();
      var r = str.match(/^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2})$/);     
      if(r==null)return   false;     
      var   d=   new   Date(r[1],   r[3]-1,   r[4]);     
      if   (d.getFullYear()==r[1]&&(d.getMonth()+1)==r[3]&&d.getDate()==r[4])   
      {   
            var   Y   =   new   Date().getFullYear();   
            $("input[name='talent[age]']").val(Y-r[1]);
      }   
      return("输入的日期格式错误！");   
}
</script>
<form method="post" action="?m=<?php echo ROUTE_M;?>&c=<?php echo ROUTE_C;?>&a=<?php echo ROUTE_A;?>&talent_type=8" id="myform">
	<div class="pad-10">
	<div class="col-tab">
	<ul class="tabBut cu-li">
		<li id="tab_info_1" class="on" onclick="SwapTab('info','on','',6,1);"><?php echo L('basic_info', '', 'admin');?></li>
		<li id="tab_info_2" onclick="SwapTab('info','on','',6,2);"><?php echo L('extend_info')?></li>
	</ul>
		<div class="col-tab">
			<div id="div_info_1" class="contentList pad-10">
				<table width="100%" class="table_form ">
					<tbody>
						<tr>
							<th width="200"><?php echo L('moter_realname')?>：</th>
							<td><input name="talent[real_name]" id="realname" class="input-text" type="text" size="40"></td>
						</tr>
						<tr>
							<th width="200"><?php echo L('moter_enname')?>：</th>
							<td><input name="talent[en_name]" id="enname" class="input-text" type="text" size="40"></td>
						</tr>
						<tr>
							<th width="200"><?php echo L('moter_nickname')?>：</th>
							<td><input name="talent[nickname]" id="nickname" class="input-text" type="text" size="40"></td>
						</tr>
						<tr>
							<th width="200"><?php echo L('moter_gender')?>：</th>
							<td><?php echo form::radio(array('1'=>L('boy'),'2'=>L('girl'),'3'=>L('secret')),'3','name="talent[gender]"')?></td>
						</tr>
						<tr>
							<th width="200"><?php echo L('talent_type')?>：</th>
							<td><?php echo form::checkbox(array(
									'is_signed_model'=>L('is_signed_model'),
									'is_student'=>L('is_student'),
									'is_network'=>L('is_network'),
									'is_guest'=>L('is_guest'),
									'is_judges'=>L('is_judges'),
									'is_star'=>L('is_star'),
									'is_teacher'=>L('is_teacher'),
							),'is_signed_model','name="talent[talent_type][]"')?>
							</td>
						</tr>
						<tr>
							<th width="200"><?php echo L('people')?>：</th>
							<td><?php echo form::radio(array('1'=>L('zh_people'),'2'=>L('ex_people')),'1','name="talent[people]"')?></td>
						</tr>
						<tr>
							<th width="200"><?php echo L('blood_type')?>：</th>
							<td><?php echo form::select(array(
									'A'=>'A型',
									'B'=>'B型',
									'O'=>'O型',
									'AB'=>'AB型',
							),0,'name="talent[blood_type]"','请选择血型')?>
							</td>
						</tr>
						<tr>
							<th width="200"><?php echo L('label')?>：</th>
							<td><?php echo form::radio(array('1'=>L('women'),'2'=>L('men'),'3'=>L('child')),'1','name="talent[label]"')?></td>
						</tr>
						<tr>
							<th width="200"><?php echo L('letter')?>：</th>
							<td><input name="talent[letter]" id="letter" class="input-text" type="text" size="1"><font color="red">请根据模特的姓氏来输入相应的英文单字母，比如说，有一个模特名叫：张蓝雨。请在该输入框输入Z(大写才可以)。</font></td>
						</tr>
						<!-- <tr>
							<th width="200"><?php echo L('source')?>：</th>
							<td><?php echo form::select($this->talent_source,1,'name="talent[source]"')?></td>
						</tr> -->
						<tr>
							<th><?php echo L('moter_birthday')?>：</th>
							<td><?php echo form::date('talent[birthday]','',0,0,true,0,'ages();');?></td>
						</tr>
						<tr>
							<th width="200"><?php echo L('moter_age')?>：</th>
							<td><input name="talent[age]" id="age" class="input-text" type="text" size="40" readonly="readonly"></td>
						</tr>
						<tr>
							<th width="200"><?php echo L('telephone')?>：</th>
							<td><input name="talent[telephone]" id="telephone" class="input-text" type="text" size="40"></td>
						</tr>
						<tr>
							<th width="200"><?php echo L('email')?>：</th>
							<td><input name="talent[email]" id="email" class="input-text" type="text" size="40"><span id="email_reminder" style="color:#959595"></span></td>
						</tr>
						<tr>
							<th width="200"><?php echo L('identification')?>：</th>
							<td><input name="talent[identification]" id="identification" class="input-text" type="text" size="40"></td>
						</tr>
						<tr>
							<th width="200"><?php echo L('o_company')?>：</th>
							<?php if(empty($this->company)):?>
							<td><input name="talent[company]" id="company" class="input-text" type="text" size="40"></td>
							<?php else:?>
							<td><?php echo form::select($this->company,0,'name="talent[company]"','请选择公司')?></td>
							<?php endif;?>
						</tr>
						<tr>
							<th width="200"><?php echo L('height')?>：</th>
							<td><input name="talent[height]" id="height" class="input-text" type="text" size="40"><font color="red">注意：请输入正整数，单位为CM</font></td>
						</tr>
						<tr>
							<th width="200"><?php echo L('weight')?>：</th>
							<td><input name="talent[weight]" id="weight" class="input-text" type="text" size="40"><font color="red">注意：请输入正整数，单位为KG</font></td>
						</tr>
						<tr>
							<th width="200"><?php echo L('university')?>：</th>
							<td><input name="talent[university]" id="university" class="input-text" type="text" size="40"></td>
						</tr>
						<tr>
							<th width="200"><?php echo L('diploma')?>：</th>
							<td><?php echo form::select($this->talent_xl,0,'name="talent[diploma]"','请选择学历')?></td>
						</tr>
						<tr>
							<th width="200"><?php echo L('province_contest')?>：</th>
							<td><?php echo form::select($this->province,0,'name="talent[province_contest]" id="province_contest"','请选择赛区省份')?></td>
						</tr>
						<tr>
							<th width="200"><?php echo L('province_native')?>：</th>
							<td><?php echo form::select($this->province,0,'name="talent[province_native]" id="province_native"','请选择籍贯省份')?></td>
						</tr>
						<tr>
							<th width="200"><?php echo L('city')?>：</th>
							<td><input name="talent[city]" id="city" class="input-text" type="text" size="40"></td>
						</tr>
						<tr>
							<th width="200"><?php echo L('bust')?>：</th>
							<td><input name="talent[bust]" id="bust" class="input-text" type="text" size="40"></td>
						</tr>
						<tr>
							<th width="200"><?php echo L('waist')?>：</th>
							<td><input name="talent[waist]" id="waist" class="input-text" type="text" size="40"></td>
						</tr>
						<tr>
							<th width="200"><?php echo L('hips')?>：</th>
							<td><input name="talent[hips]" id="hips" class="input-text" type="text" size="40"></td>
						</tr>
						<tr>
							<th width="200"><?php echo L('shoe_size')?>：</th>
							<td><input name="talent[shoe_size]" id="shoe_size" class="input-text" type="text" size="40"></td>
						</tr>
						<tr>
							<th width="200"><?php echo L('address')?>：</th>
							<td><input name="talent[address]" id="address" class="input-text" type="text" size="40"></td>
						</tr>
						<tr>
							<th width="200">城市（官网）：</th>
							<td><?php echo form::select($this->city,0,'name="talent[new_city]"','请选择城市')?><font color="red"> 该字段用于前台根据城市条件搜索模特使用</font></td>
						</tr>
						<tr>
							<th width="200">人才所在洲：</th>
							<td><?php echo form::select($this->continent,0,'name="talent[continent]"','请选择')?></td>
						</tr>
						<tr>
							<th width="200">国家：</th>
							<td>
								<select name="talent[nation_cn]">
									<option value="">请选择</option>
									<?php foreach ($this->nation as $v) {?>
									<option value="<?=$v['nation_cn']?>|<?=$v['nation_en']?>"><?=$v['nation_cn']?>/<?=$v['nation_en']?></option>
									<?php }?>
								</select>
							</td>
						</tr>
						<tr>
							<th width="200"><?php echo L('voice_url')?>：</th>
							<td><?php echo form::upfiles('talent[voice_url]', 'voice_url', '', '', '', 40, '', '', 'mp3','voice_placeholder_name')?></td>
						</tr>
						<tr>
							<th width="200">视频链接：</th>
							<td><?php echo form::upfiles('talent[video_url]', 'video_url', '', '', '', 40, '', '', 'mp4|avi')?></td>
						</tr>
						<tr>
							<th>视频封面图：</th>
							<td><?php echo form::images('talent[video_cover]', 'video_cover', '', 'moter', '', 40)?></td>
						</tr>
					</tbody>
				</table>
			</div>
			<div id="div_info_2" class="contentList pad-10 hidden">
				<table width="100%" class="table_form ">
						<tr>
							<th><?php echo L('image_square')?>：</th>
							<td><?php echo form::images('talent[image_square]', 'image_square', '', 'moter', '', 40)?><font color="red">为保证显示效果，请上传宽高为500*500的图片</font></td>
						</tr>
						<tr>
							<th><?php echo L('image_circular')?>：</th>
							<td><?php echo form::images('talent[image_circular]', 'image_circular', '', 'moter', '', 40)?><font color="red">为保证显示效果，请上传宽高为500*500的图片</font></td>
						</tr>
						<tr>
							<th><?php echo L('image_horizontal')?>：</th>
							<td><?php echo form::images('talent[image_horizontal]', 'image_horizontal', '', 'moter', '', 40)?><font color="red">为保证显示效果，请上传宽高为500*340的图片</font></td>
						</tr>
						<tr>
							<th><?php echo L('image_vertical')?>：</th>
							<td><?php echo form::images('talent[image_vertical]', 'image_vertical', '', 'moter', '', 40)?><font color="red">为保证显示效果，请上传宽高为500*650的图片</font></td>
						</tr>
						<tr>
							<th width="200"><?php echo L('hobby')?>：</th>
							<td><textarea name="talent[hobby]" id="hobby"></textarea><?php echo form::editor('hobby','full','','','',1,1,'')?></td>
						</tr>
						<tr>
							<th width="200"><?php echo L('introduction')?>：</th>
							<td><textarea name="talent[introduction]" id="introduction"></textarea><?php echo form::editor('introduction','full','','','',1,1,'')?></td>
						</tr>
						<tr>
							<th width="200"><?php echo L('award')?>：</th>
							<td><textarea name="talent[award]" id="award"></textarea><?php echo form::editor('award','full','','','',1,1,'')?></td>
						</tr>
						<tr>
							<th width="200"><?php echo L('autograph')?>：</th>
							<td><textarea name="talent[autograph]" id="autograph"></textarea><?php echo form::editor('autograph','full','','','',1,1,'')?></td>
						</tr>
						<input type="hidden" name="talent[menuid]" value="<?php echo $_GET['menuid']?>">
				</table>
			</div>
			<div class="bk15"></div>
			<?php if($action_source=="talent_categroy"){ ?>
				<input type="hidden" name="catid" value="<?= $catid?>">
				<input type="hidden" name="id" value="<?= $id?>">
				<input type="hidden" name="source_type" value="<?= $source_type?>">
			<?php }?>
			<input name="dosubmit" type="submit"   <?php if($action_source=="contestant" || $action_source=="talent_categroy"){ ?>class="dialog "  <?php }else{ ?>class="button" <?php }?>id="dosubmit"  value="<?php echo L('submit')?>" >
			<?php if($action_source=="contestant"){ ?><input type="hidden" name="contest_id" value="<?= $contest_id?>"><?php }?>
		</div>
	</div>
</div>
</form>

</body>
</html>
<script type="text/javascript">

function SwapTab(name,cls_show,cls_hide,cnt,cur){
	for(i=1;i<=cnt;i++){
		if(i==cur){
			 $('#div_'+name+'_'+i).show();
			 $('#tab_'+name+'_'+i).attr('class',cls_show);
		}else{
			 $('#div_'+name+'_'+i).hide();
			 $('#tab_'+name+'_'+i).attr('class',cls_hide);
		}
	}
}
//校验手机号
function isTel(tel){
	if(!(/^1(3[0-9]|5[012356789]|8[0-9]|4[7]|7[678])\d{8}$/.test(tel))) return "请输入正确的手机号";
	return true;
}

//校验真实姓名
function isRealname(realname){
	if(!(/^[\u4e00-\u9fa5]{2,4}$/i.test(realname))) return "请填写真实姓名";
	return true;
}

//校验邮箱
function isEmail(email){
	if(!(/^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/.test(email))) return "请输入正确的邮箱";
	return true;
}
//校验大写字母
function isWordbig(word){
	if(!(/^[A-Z]+$/.test(word))) return "请输入正确的姓氏首字母";
	return true;
}
$(document).ready(function(){
	$.formValidator.initConfig({formid:"myform",autotip:true,onerror:function(msg,obj){window.top.art.dialog({content:msg,lock:true,width:'220',height:'70'}, function(){this.close();$(obj).focus();})}});
	$('#realname').formValidator({
		autotip:true,
		onshow:"<?php echo L('please_input_moter_realname')?>",
		onfocus:"<?php echo L('please_input_moter_realname')?>",
		oncorrect:"<?php echo L('right')?>"}).inputValidator({
			min:1,onerror:"<?php echo L('please_input_moter_realname')?>"
		}).functionValidator({fun:isRealname}).ajaxValidator({
			type:"GET",
			url:"",
			data:"m=talent&c=manage&a=auto_letter",
			datatype:"html",
			cache:false,
			async:"true",
			success:function(data){
				if(data !="" && data !="undefined"){
					$("input[name='talent[letter]']").val(data);
					return true;
					}
				}
			});
	$('#email').formValidator({
    	autotip:false,
    	onshow:'<?php echo L('please_input_email')?>',
        empty:true}).functionValidator({fun:isEmail});
    $('#identification').formValidator({
    	autotip:false,
    	onshow:'<?php echo L('please_input_identification')?>',
        empty:true}).functionValidator({fun:isCardID});
    $('#letter').formValidator({
		autotip:true,
		onshow:"<?php echo L('please_input_moter_letter')?>",
		onfocus:"<?php echo L('please_input_moter_letter')?>",
		oncorrect:"<?php echo L('right')?>"}).inputValidator({
			min:1,onerror:"<?php echo L('please_input_moter_letter')?>"
		}).functionValidator({fun:isWordbig});
    $('#height').formValidator({
    	autotip:false,
    	onshow:'<?php echo L('please_input_integer')?>',
    	onfocus: '<?php echo L('please_input_height_true')?>',
    	oncorrect: '<?php echo L('true')?>',
        empty:true}).regexValidator({regexp: regexEnum.intege1,onerror: '<?php echo L('height_false')?>'});
    $('#weight').formValidator({
    	autotip:false,
    	onshow:'<?php echo L('please_input_integer')?>',
    	onfocus: '<?php echo L('please_input_weight_true')?>',
    	oncorrect: '<?php echo L('true')?>',
        empty:true}).regexValidator({regexp: regexEnum.intege1,onerror: '<?php echo L('weight_false')?>'});
});
</script>